#!/usr/bin/env bash

DIR_NAME_01=test01
rm -r -f ${DIR_NAME_01}
mkdir ${DIR_NAME_01}
cd ${DIR_NAME_01}
git init

cp -f ../../111.txt 111.txt
git add 111.txt
git commit -m "master：add 111.txt"
git tag v111

cp -f ../../222.txt 222.txt
git add 222.txt
git commit -m "master：add 222.txt"
git tag v222

cp -f ../../333.txt 333.txt
git add 333.txt
git commit -m "master：add 333.txt"
git tag v333

cd ..
DIR_NAME_02=test02
rm -r -f ${DIR_NAME_02}
mkdir ${DIR_NAME_02}
cd ${DIR_NAME_02}
git init

cd ..
cd ${DIR_NAME_01}
git diff v111..v333 > patch.patch

cd ..

cd ${DIR_NAME_02}
git apply ../${DIR_NAME_01}/patch.patch
#expect test02 has 222.txt 333.txt
